<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>getsid</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_005_740">&nbsp;</a>NAME</h4><blockquote>
getsid - get the process group ID of session leader
</blockquote><h4><a name = "tag_000_005_741">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;

pid_t getsid(pid_t <i>pid</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_005_742">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>getsid()</i>
function obtains the process group ID of the process that is the session
leader of the process specified by <i>pid</i>.  If <i>pid</i> is
(<b>pid_t</b>)0,
it specifies the calling process.
</blockquote><h4><a name = "tag_000_005_743">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>getsid()</i>
returns the process group ID of the session leader of the specified process.
Otherwise, it returns (<b>pid_t</b>)-1 and sets <i>errno</i> to
indicate the error.
</blockquote><h4><a name = "tag_000_005_744">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>getsid()</i>
function will fail if:
<dl compact>

<dt>[EPERM]<dd>
The process specified by <i>pid</i> is not in the same session as the calling
process, and the implementation does not allow access to the process group ID
of the session leader of that process from the calling process.

<dt>[ESRCH]<dd>
There is no process with a process ID equal to <i>pid</i>.

</dl>
</blockquote><h4><a name = "tag_000_005_745">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_746">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_747">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_748">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="exec.html">exec</a></i>,
<i><a href="fork.html">fork()</a></i>,
<i><a href="getpid.html">getpid()</a></i>,
<i><a href="getpgid.html">getpgid()</a></i>,
<i><a href="setpgid.html">setpgid()</a></i>,
<i><a href="setsid.html">setsid()</a></i>,
<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
